using System.IO;

namespace SolutionFactory.Services
{
    public abstract class MatchingFileVisitor : IFileVisitor
    {
        private readonly string _fileExtension;

        protected MatchingFileVisitor(string fileExtension)
        {
            _fileExtension = fileExtension;
        }

        public void Visit(FileInfo file)
        {
            if(file.Extension == _fileExtension)
            {
                VisitMatchingFile(file);
            }
        }

        protected abstract void VisitMatchingFile(FileInfo file);
    }
}